package com.yomahub.liteflow.example.xstream;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import com.thoughtworks.xstream.converters.basic.BooleanConverter;
import com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter;
import com.yomahub.liteflow.example.xstream.converter.SingleValueCalendarConverter;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * @program: liteflow-example
 * @description:
 * @author: yyyyjinying
 * @create: 2023-09-25 23:04
 **/
@XStreamAlias("message")
//@XStreamConverter(value= ToAttributedValueConverter.class, strings={"content"})
public class RendezvousMessageTwo {
    @XStreamAlias("type")
    @XStreamOmitField // 不显示
    private int messageType;

    private String content;

    @XStreamConverter(value= BooleanConverter.class, booleans={false}, strings={"yes", "no"})
    private boolean important;

    @XStreamConverter(SingleValueCalendarConverter.class)
    private Calendar created = new GregorianCalendar();

    public RendezvousMessageTwo(int messageType, boolean important, String content) {
        this.messageType = messageType;
        this.important = important;
        this.content = content;
    }
}
